<!DOCTYPE html>
<html>

<head>
    <title>H-Cloud</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="./assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="./assets/css/admin.css"/>
    <link rel="stylesheet" href="./assets/libs/zTree/css/metroStyle/metroStyle.css"/>
    <link href="./assets/images/favicon.ico" rel="SHORTCUT ICON">
    <style>
        /**
重写部分layui样式，适应需要，add by hepangui
 */
        body .view-card{
            height:100% !important
        }
        body .layui-fluid{
            height:100% !important;
        }
        body .layui-card{
            height:100% !important;
        }
        body .layui-card-body{
            height:100% !important;
        }
        body .layui-card-body {
            padding: 1px 10px;
        }
        .layui-layout-admin .layui-body {
            bottom: 10px;
        }
    </style>
</head>

<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">

    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="assets/images/logo.png"/>
            <cite>&nbsp;H-Cloud&emsp;</cite>
        </div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" lay-unselect>
                <a id="btnMessage" title="消息"><i class="layui-icon layui-icon-notice"></i></a>
            </li>
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a>
                    <img src="assets/images/head.png" class="layui-nav-img">
                    <cite id="user-name-index">管理员</cite>
                </a>
                <dl class="layui-nav-child">
                    <dd lay-unselect>
                        <a id="setInfo">个人信息</a>
                    </dd>
                    <dd lay-unselect>
                        <a id="setPsw">修改密码</a>
                    </dd>
                    <dd lay-unselect>
                        <a id="setWeixin">绑定微信</a>
                    </dd>
                    <dd lay-unselect>
                        <a id="setQq">绑定qq</a>
                    </dd>
                    <hr>
                    <dd lay-unselect>
                        <a id="btnLogout">退出</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
            </li>
        </ul>
    </div>

    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="admin-side-nav" lay-accordion="true" style="margin: 15px 0;">
                <!-- 侧边栏渲染模板 -->
                <script id="sideNav" type="text/html">
                    {{#  layui.each(d, function(index, item){ }}
                    <li class="layui-nav-item">
                        <a href="{{item.menuHref?item.menuUrl:'javascript:void(0)'}}" lay-href="{{item.menuUrl}}"><i class="{{item.menuIcon}}"></i>&emsp;<cite>{{item.name
                            }}</cite></a>
                        {{# if(item.children&&item.children.length>0){ }}
                        <dl class="layui-nav-child">
                            {{# layui.each(item.children, function(index, subItem){ }}
                            <dd>
                                <a href="{{ subItem.menuHref }}" lay-href="{{ subItem.menuUrl }}"><i class="{{subItem.menuIcon}}"></i>&emsp;{{ subItem.name }}</a>
                                {{# if(subItem.children&&subItem.children.length>0){ }}
                                <dl class="layui-nav-child">
                                    {{# layui.each(subItem.children, function(index, thrItem){ }}
                                    <dd><a href="{{ thrItem.menuHref }}" lay-href="{{ thrItem.menuUrl }}"><i class="{{thrItem.menuIcon}}"></i>&emsp;{{ thrItem.name }}</a></dd>
                                    {{# }); }}
                                </dl>
                                {{# } }}
                            </dd>
                            {{# }); }}
                        </dl>
                        {{# } }}
                    </li>
                    {{#  }); }}
                </script>

            </ul>
        </div>
    </div>

    <!-- 主体部分 -->
    <div class="layui-body">
        <div class="layui-tab" lay-allowClose="true" lay-filter="admin-pagetabs">
            <ul class="layui-tab-title">
                <li lay-id="home">
                    <i class="layui-icon layui-icon-home"></i><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>
                </li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div id="home" class="view-card">
                        <div class="layui-fluid">
                            <div class="layui-card">
                                <div class="layui-card-body">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-icon admin-tabs-control layui-icon-prev" ew-event="leftPage"></div>
        <div class="layui-icon admin-tabs-control layui-icon-next" ew-event="rightPage"></div>
        <div class="layui-icon admin-tabs-control layui-icon-down">
            <ul class="layui-nav admin-tabs-select" lay-filter="admin-pagetabs-nav">
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;"></a>
                    <dl class="layui-nav-child layui-anim-fadein">
                        <dd ew-event="closeThisTabs" lay-unselect><a href="javascript:;">关闭当前标签页</a></dd>
                        <dd ew-event="closeOtherTabs" lay-unselect><a href="javascript:;">关闭其它标签页</a></dd>
                        <dd ew-event="closeAllTabs" lay-unselect><a href="javascript:;">关闭全部标签页</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <!-- 底部 -->
    <!--<div class="layui-footer">-->
        <!--Copyright © 2018 <a href="https://easyweb.vip" target="_blank">H-Cloud</a> All rights reserved.-->
        <!--<span class="pull-right">Version 0.0.4</span>-->
    <!--</div>-->

    <!-- 手机屏幕遮罩层 -->
    <div class="site-mobile-shade"></div>

</div>

<!-- 加载动画，移除位置在common.js中 -->
<div class="page-loading">
    <div class="rubik-loader"></div>
</div>

<!-- js部分 -->
<script type="text/javascript" src="../assets/libs/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="./assets/libs/q.js"></script>
<script type="text/javascript" src="./assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="./assets/libs/zTree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="./assets/js/common.js"></script>
<script>
    layui.use(['layer', 'element', 'admin', 'index','config'], function () {
        var config = layui.config;
        var $ = layui.jquery;
        if(!config.getToken()){
            location.replace("./login.html")
        }else{
            var user = config.getUser();
            $("#user-name-index").html(user.name);
        }
        var layer = layui.layer;
        var admin = layui.admin;
        var index = layui.index;
        index.initLeftNav();
        // 消息点击事件
        $('#btnMessage').click(function () {
            admin.popupRight({
                type: 2,
                content: 'tpl-message.html'
            });
        });

        // 修改密码点击事件
        $('#setPsw').click(function () {
            admin.openForm({
                title: '修改密码',
                area: ['500px', '290px'],
                submitId:"system-user-password-submit",
                path: 'system/user/password.html'
            });
        });

        // 退出登录点击事件
        $('#btnLogout').click(function () {
            layer.confirm('确定退出登录？', function () {
                config.removeUser();
                location.replace('login.html');
            });
        });

        // 个人信息点击事件
        $('#setInfo').click(function () {
            admin.openForm({
                see:true,
                title: '修改密码',
                // area: ['500px', '290px'],
                submitId:"system-user-info-submit",
                path: 'system/user/userInfo.html'
            });
        });


        $("#setWeixin").click(function(){
            var appid = config.weixinappid;
            var number = location.href.indexOf("?");
            if(number == -1){
                number = location.href.indexOf("#");
            }
            if(number==-1){
                var redirect_uri =encodeURI(location.href.replace("index.html","bind.html"));
            }else{
                var redirect_uri =encodeURI(location.href.substring(0,number).replace("index.html","bind.html"));
            }
            window.open("https://open.weixin.qq.com/connect/qrconnect?appid="
                +appid+"&redirect_uri="+redirect_uri
                +"&state=weixin&response_type=code&scope=snsapi_login#wechat_redirect");
        })

        $("#setQq").click(function(){
            var appid = config.qqappid;
            var number = location.href.indexOf("?");
            if(number == -1){
                number = location.href.indexOf("#");
            }
            if(number==-1){
                var redirect_uri =encodeURI(location.href.replace("index.html","bind.html"));
            }else{
                var redirect_uri =encodeURI(location.href.substring(0,number).replace("index.html","bind.html"));
            }
            window.open("https://graph.qq.com/oauth2.0/authorize?response_type=code&state=qq" +
                "&client_id=" + appid + '&redirect_uri=' + redirect_uri);
        })
    });
</script>
</body>

</html>